/**
 * ISchema.java
 * Copyright (C) 2011 Yuanyan<yuanyan.cao@gmail.com>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * For information on how to redistribute this software under
 * the terms of a license other than GNU General Public License
 * contact yuanyan.cao@gmail.com
 */
package edu.rabbit.schema;

import java.util.Set;

import edu.rabbit.DbException;

/**
 * Database schema interface.
 * 
 * @author Yuanyan<yanyan.cao@gmail.com>
 * 
 */
public interface ISchema {

    /**
     * Get tables names.
     * 
     * @return tables names.
     * @throws DbException
     */
    Set<String> getTableNames() throws DbException;

    /**
     * Get table definition by name.
     * 
     * @param name
     *            table name
     * @return table definition
     * @throws DbException
     */
    ITableDef getTable(String name) throws DbException;

    /**
     * Get indices names.
     * 
     * @return indices names.
     * @throws DbException
     */
    Set<String> getIndexNames() throws DbException;

    /**
     * Get index definition by name.
     * 
     * @param name
     *            index name
     * @return index definition
     * @throws DbException
     */
    IIndexDef getIndex(String name) throws DbException;

    /**
     * Get indices related with table.
     * 
     * @param tableName
     *            table name
     * @return indices of table
     * @throws DbException
     */
    Set<IIndexDef> getIndexes(String tableName) throws DbException;

    /**
     * @return Set of virtual table names defined in this schema.
     * 
     * @throws DbException
     */
    Set<String> getVirtualTableNames() throws DbException;

    /**
     * @param name
     * @return definition of the virtual table <code>name</code>.
     * 
     * @throws DbException
     */
    IVirtualTableDef getVirtualTable(String name) throws DbException;
}
